﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {
            int a = 0;
        }

        private void button2_MouseMove(object sender, MouseEventArgs e)
        {
            moveNoButton();
        }

        private void button2_MouseEnter(object sender, EventArgs e)
        {
            moveNoButton();
     
        }
        private void moveNoButton()
        {

            Random r = new Random();
            button2.Top =  r.Next(Height - button2.Height);
            button2.Left = r.Next(Width - button2.Width);

        }

        private void button2_MouseClick(object sender, MouseEventArgs e)
        {
            moveNoButton();
        }

        private void button2_MouseLeave(object sender, EventArgs e)
        {
            moveNoButton();
        }

        private void button1_Click(object sender, EventArgs e)
        {
          DialogResult re =  MessageBox.Show("Ну сочувствую тебе я (Могистор Ёда) закрыть всё?","Важное сообщение",MessageBoxButtons.YesNo);
          if (re == DialogResult.Yes)
          {
              Close();

          }
          else { }
        }
    }
}
